<template>
	<view>
		<view style="background-color: #FFFFFF;">
			<cu-custom :isBack="true">
				<block slot="backText"></block>
				<block slot="content">货物上架</block>
			</cu-custom>
		</view>
		<view class="cu-bar bg-white solid-bottom margin-top">
			<view class="action">
				<text class="cuIcon-title text-orange "></text> 调拨单列表
			</view>
		</view>
		<scroll-view scroll-y="true" class="indexes" :scroll-with-animation="true"
			style="background-color:  #FFFFFF;"
			:style="[{height:'calc('+ height +'px )'}]">
			<view class="cu-list menu-avatar" v-for="(item, index) in list" :key="index" @click="poslock(index)">
				<view class="cu-item">
					<view class="content">
						<view class="text-grey">{{item.ctvcode}}</view>
						<view class="text-gray text-sm flex">
							<view class="text-cut">
								<text class="cuIcon-infofill text-red  margin-right-xs"></text>
								{{item.csysbarcode}}
							</view> </view>
					</view>
				</view>
			</view>
		</scroll-view>
	</view>
</template>

<script>
	import {
		mapState
	} from 'vuex';
	export default {
		data() {
			return {
				CustomBar: this.CustomBar, //滚动定位用
				list:[],
				height:'',
			}
		},
		computed: {
			...mapState(['hasLogin', 'userInfo', 'auditlist', 'corpCode']),
		},
		onLoad() {
			let height = 0;
			uni.getSystemInfo({
				success: function(res) {
					height = res.windowHeight * 0.83;
				}
			});
			this.height = height;
			this.loadData();
		},
		methods: {
			/**
			 * 加载初始数据s
			 */
			loadData(){
				uni.request({
					url:this.serverURL_a+'/wh/db/whDbTransVouch/listData?ajax=json',
					data:{
						__sid:this.userInfo.sessionid
					},
					header: {
						'content-type': 'application/x-www-form-urlencoded;charset=utf-8',
					},
					method: 'POST',
					success:function(data){
						var res = data;
						this.list = [];
						if(res.errMsg.indexOf("ok") > -1){
							var resDt = res.data;
							this.list = resDt.list;
						}else{
							uni.showModal({
							    content: res.message,
								showCancel:false,
							});
							return;
						}
					}.bind(this),
					fail:function(){
						this.$api.msg('服务已停止,请稍后再试');
						return;
					}.bind(this),
				});
			},
			
			poslock(index){
				var id = this.list[index].id;
				uni.navigateTo({
					url: '/pages/cwhJustinv/cwhJustUp?id='+id,
				})
			},
		}
	}
</script>

<style>

</style>
